/**
 * 
 */
package com.gr.staffpm.search;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.gr.staffpm.tasks.service.TaskService;


/**
 * @author Graham Rhodes 1 Mar 2011 17:55:27
 */
public class Indexer {

    private static Indexer instance = null;
    private static boolean indexed = false;
    private final Logger log = LoggerFactory.getLogger(getClass());

    protected Indexer() {
        //Singleton
    }

    public static Indexer getInstance() {
        if (instance == null)
            instance = new Indexer();
        return instance;
    }

    public void createIndex(TaskService taskService) {
        if (!indexed) {
            log.info("Creating Lucene Search Index...");
            taskService.createIndex();
            indexed = true;
        }
    }

    public boolean isIndexed() {
        return indexed;
    }

}
